Add PUT /users/:id update endpoint - #90
Open
MarinaKramarchuk wants to merge 3 commits into
Open
Conversation
Follows the existing pattern (getUserById/createUser) so route handlers stay thin and data access lives in one place.
Validates name and email the same way POST does, returns 404 when the id doesn't exist, and 200 with the updated user otherwise.
Plan, model choice, commit split, and self-review findings for the update-user endpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateUser(id, { name, email })todb/store.js, following the existinggetUserById/createUserpattern.PUT /users/:idtoroutes/users.js: validatesname/emailthe same wayPOST /usersdoes (400 on missing field), returns 404 for an unknown id, 200 with the updated user otherwise.NOTES.mdcovering the plan, model choice, commit split, and self-review.Why
Ships the "update a user" endpoint required by the course project, following the codebase's existing route/store conventions.
Test plan
npm test— all 9 tests pass, including the three grading tests intests/update-user.test.js(200 update, 404 for unknown id, 400 for missing field) and the twoNOTES.mdchecks.npm run lint— clean./code-review— no findings.🤖 Generated with Claude Code